{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 08 Scikit-learn中的Scaler"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "from sklearn import datasets"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "iris = datasets.load_iris()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "X = iris.data\n",
    "y = iris.target"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 5.1,  3.5,  1.4,  0.2],\n",
       "       [ 4.9,  3. ,  1.4,  0.2],\n",
       "       [ 4.7,  3.2,  1.3,  0.2],\n",
       "       [ 4.6,  3.1,  1.5,  0.2],\n",
       "       [ 5. ,  3.6,  1.4,  0.2],\n",
       "       [ 5.4,  3.9,  1.7,  0.4],\n",
       "       [ 4.6,  3.4,  1.4,  0.3],\n",
       "       [ 5. ,  3.4,  1.5,  0.2],\n",
       "       [ 4.4,  2.9,  1.4,  0.2],\n",
       "       [ 4.9,  3.1,  1.5,  0.1]])"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X[:10,:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from sklearn.model_selection import train_test_split"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "X_train, X_test, y_train, y_test = train_test_split(iris.data, iris.target, test_size=0.2, random_state=666)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### scikit-learn中的StandardScaler"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from sklearn.preprocessing import StandardScaler "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "standardScalar = StandardScaler() "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "StandardScaler(copy=True, with_mean=True, with_std=True)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "standardScalar.fit(X_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 5.83416667,  3.0825    ,  3.70916667,  1.16916667])"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "standardScalar.mean_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0.81019502,  0.44076874,  1.76295187,  0.75429833])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "standardScalar.scale_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[-0.90616043,  0.94720873, -1.30982967, -1.28485856],\n",
       "       [-1.15301457, -0.18717298, -1.30982967, -1.28485856],\n",
       "       [-0.16559799, -0.64092567,  0.22169257,  0.17345038],\n",
       "       [ 0.45153738,  0.72033239,  0.95909217,  1.49918578],\n",
       "       [-0.90616043, -1.3215547 , -0.40226093, -0.0916967 ],\n",
       "       [ 1.43895396,  0.2665797 ,  0.56203085,  0.30602392],\n",
       "       [ 0.3281103 , -1.09467835,  1.07253826,  0.30602392],\n",
       "       [ 2.1795164 , -0.18717298,  1.63976872,  1.2340387 ],\n",
       "       [-0.78273335,  2.30846679, -1.25310662, -1.4174321 ],\n",
       "       [ 0.45153738, -2.00218372,  0.44858475,  0.43859746],\n",
       "       [ 1.80923518, -0.41404933,  1.46959958,  0.83631808],\n",
       "       [ 0.69839152,  0.2665797 ,  0.90236912,  1.49918578],\n",
       "       [ 0.20468323,  0.72033239,  0.44858475,  0.571171  ],\n",
       "       [-0.78273335, -0.86780201,  0.10824648,  0.30602392],\n",
       "       [-0.53587921,  1.40096142, -1.25310662, -1.28485856],\n",
       "       [-0.65930628,  1.40096142, -1.25310662, -1.28485856],\n",
       "       [-1.0295875 ,  0.94720873, -1.19638358, -0.7545644 ],\n",
       "       [-1.77014994, -0.41404933, -1.30982967, -1.28485856],\n",
       "       [-0.04217092, -0.86780201,  0.10824648,  0.04087684],\n",
       "       [-0.78273335,  0.72033239, -1.30982967, -1.28485856],\n",
       "       [-1.52329579,  0.72033239, -1.30982967, -1.15228502],\n",
       "       [ 0.82181859,  0.2665797 ,  0.78892303,  1.10146516],\n",
       "       [-0.16559799, -0.41404933,  0.27841562,  0.17345038],\n",
       "       [ 0.94524567, -0.18717298,  0.39186171,  0.30602392],\n",
       "       [ 0.20468323, -0.41404933,  0.44858475,  0.43859746],\n",
       "       [-1.39986872,  0.2665797 , -1.19638358, -1.28485856],\n",
       "       [-1.15301457,  0.03970336, -1.25310662, -1.4174321 ],\n",
       "       [ 1.06867274,  0.03970336,  1.07253826,  1.63175932],\n",
       "       [ 0.57496445, -0.86780201,  0.67547694,  0.83631808],\n",
       "       [ 0.3281103 , -0.64092567,  0.56203085,  0.04087684],\n",
       "       [ 0.45153738, -0.64092567,  0.61875389,  0.83631808],\n",
       "       [-0.16559799,  2.98909581, -1.25310662, -1.01971148],\n",
       "       [ 0.57496445, -1.3215547 ,  0.67547694,  0.43859746],\n",
       "       [ 0.69839152, -0.41404933,  0.33513866,  0.17345038],\n",
       "       [-0.90616043,  1.62783776, -1.02621444, -1.01971148],\n",
       "       [ 1.19209981, -0.64092567,  0.61875389,  0.30602392],\n",
       "       [-0.90616043,  0.94720873, -1.30982967, -1.15228502],\n",
       "       [-1.89357701, -0.18717298, -1.47999881, -1.4174321 ],\n",
       "       [ 0.08125616, -0.18717298,  0.78892303,  0.83631808],\n",
       "       [ 0.69839152, -0.64092567,  1.07253826,  1.2340387 ],\n",
       "       [-0.28902506, -0.64092567,  0.67547694,  1.10146516],\n",
       "       [-0.41245214, -1.54843104, -0.00519961, -0.22427024],\n",
       "       [ 1.31552689,  0.03970336,  0.67547694,  0.43859746],\n",
       "       [ 0.57496445,  0.72033239,  1.07253826,  1.63175932],\n",
       "       [ 0.82181859, -0.18717298,  1.18598435,  1.36661224],\n",
       "       [-0.16559799,  1.62783776, -1.13966053, -1.15228502],\n",
       "       [ 0.94524567, -0.41404933,  0.5053078 ,  0.17345038],\n",
       "       [ 1.06867274,  0.49345605,  1.12926131,  1.76433286],\n",
       "       [-1.27644165, -0.18717298, -1.30982967, -1.4174321 ],\n",
       "       [-1.0295875 ,  1.17408507, -1.30982967, -1.28485856],\n",
       "       [ 0.20468323, -0.18717298,  0.61875389,  0.83631808],\n",
       "       [-1.0295875 , -0.18717298, -1.19638358, -1.28485856],\n",
       "       [ 0.3281103 , -0.18717298,  0.67547694,  0.83631808],\n",
       "       [ 0.69839152,  0.03970336,  1.01581521,  0.83631808],\n",
       "       [-0.90616043,  1.40096142, -1.25310662, -1.01971148],\n",
       "       [-0.16559799, -0.18717298,  0.27841562,  0.04087684],\n",
       "       [-1.0295875 ,  0.94720873, -1.36655271, -1.15228502],\n",
       "       [-0.90616043,  1.62783776, -1.25310662, -1.15228502],\n",
       "       [-1.52329579,  0.2665797 , -1.30982967, -1.28485856],\n",
       "       [-0.53587921, -0.18717298,  0.44858475,  0.43859746],\n",
       "       [ 0.82181859, -0.64092567,  0.5053078 ,  0.43859746],\n",
       "       [ 0.3281103 , -0.64092567,  0.16496953,  0.17345038],\n",
       "       [-1.27644165,  0.72033239, -1.19638358, -1.28485856],\n",
       "       [-0.90616043,  0.49345605, -1.13966053, -0.88713794],\n",
       "       [-0.04217092, -0.86780201,  0.78892303,  0.96889162],\n",
       "       [-0.28902506, -0.18717298,  0.22169257,  0.17345038],\n",
       "       [ 0.57496445, -0.64092567,  0.78892303,  0.43859746],\n",
       "       [ 1.06867274,  0.49345605,  1.12926131,  1.2340387 ],\n",
       "       [ 1.68580811, -0.18717298,  1.18598435,  0.571171  ],\n",
       "       [ 1.06867274, -0.18717298,  0.84564608,  1.49918578],\n",
       "       [-1.15301457,  0.03970336, -1.25310662, -1.4174321 ],\n",
       "       [-1.15301457, -1.3215547 ,  0.44858475,  0.70374454],\n",
       "       [-0.16559799, -1.3215547 ,  0.73219998,  1.10146516],\n",
       "       [-1.15301457, -1.54843104, -0.2320918 , -0.22427024],\n",
       "       [-0.41245214, -1.54843104,  0.05152343, -0.0916967 ],\n",
       "       [ 1.06867274, -1.3215547 ,  1.18598435,  0.83631808],\n",
       "       [ 0.82181859, -0.18717298,  1.01581521,  0.83631808],\n",
       "       [-0.16559799, -1.09467835, -0.1186457 , -0.22427024],\n",
       "       [ 0.20468323, -2.00218372,  0.73219998,  0.43859746],\n",
       "       [ 1.06867274,  0.03970336,  0.56203085,  0.43859746],\n",
       "       [-1.15301457,  0.03970336, -1.25310662, -1.4174321 ],\n",
       "       [ 0.57496445, -1.3215547 ,  0.73219998,  0.96889162],\n",
       "       [-1.39986872,  0.2665797 , -1.36655271, -1.28485856],\n",
       "       [ 0.20468323, -0.86780201,  0.78892303,  0.571171  ],\n",
       "       [-0.04217092, -1.09467835,  0.16496953,  0.04087684],\n",
       "       [ 1.31552689,  0.2665797 ,  1.12926131,  1.49918578],\n",
       "       [-1.77014994, -0.18717298, -1.36655271, -1.28485856],\n",
       "       [ 1.56238103, -0.18717298,  1.2427074 ,  1.2340387 ],\n",
       "       [ 1.19209981,  0.2665797 ,  1.2427074 ,  1.49918578],\n",
       "       [-0.78273335,  0.94720873, -1.25310662, -1.28485856],\n",
       "       [ 2.54979762,  1.62783776,  1.52632263,  1.10146516],\n",
       "       [ 0.69839152, -0.64092567,  1.07253826,  1.36661224],\n",
       "       [-0.28902506, -0.41404933, -0.06192266,  0.17345038],\n",
       "       [-0.41245214,  2.53534313, -1.30982967, -1.28485856],\n",
       "       [-1.27644165, -0.18717298, -1.30982967, -1.15228502],\n",
       "       [ 0.57496445, -0.41404933,  1.07253826,  0.83631808],\n",
       "       [-1.77014994,  0.2665797 , -1.36655271, -1.28485856],\n",
       "       [-0.53587921,  1.8547141 , -1.13966053, -1.01971148],\n",
       "       [-1.0295875 ,  0.72033239, -1.19638358, -1.01971148],\n",
       "       [ 1.06867274, -0.18717298,  0.73219998,  0.70374454],\n",
       "       [-0.53587921,  1.8547141 , -1.36655271, -1.01971148],\n",
       "       [ 2.30294347, -0.64092567,  1.69649176,  1.10146516],\n",
       "       [-0.28902506, -0.86780201,  0.27841562,  0.17345038],\n",
       "       [ 1.19209981, -0.18717298,  1.01581521,  1.2340387 ],\n",
       "       [-0.41245214,  0.94720873, -1.36655271, -1.28485856],\n",
       "       [-1.27644165,  0.72033239, -1.02621444, -1.28485856],\n",
       "       [-0.53587921,  0.72033239, -1.13966053, -1.28485856],\n",
       "       [ 2.30294347,  1.62783776,  1.69649176,  1.36661224],\n",
       "       [ 1.31552689,  0.03970336,  0.95909217,  1.2340387 ],\n",
       "       [-0.28902506, -1.3215547 ,  0.10824648, -0.0916967 ],\n",
       "       [-0.90616043,  0.72033239, -1.25310662, -1.28485856],\n",
       "       [-0.90616043,  1.62783776, -1.19638358, -1.28485856],\n",
       "       [ 0.3281103 , -0.41404933,  0.56203085,  0.30602392],\n",
       "       [-0.04217092,  2.08159044, -1.42327576, -1.28485856],\n",
       "       [-1.0295875 , -2.45593641, -0.1186457 , -0.22427024],\n",
       "       [ 0.69839152,  0.2665797 ,  0.44858475,  0.43859746],\n",
       "       [ 0.3281103 , -0.18717298,  0.5053078 ,  0.30602392],\n",
       "       [ 0.08125616,  0.2665797 ,  0.61875389,  0.83631808],\n",
       "       [ 0.20468323, -2.00218372,  0.16496953, -0.22427024],\n",
       "       [ 1.93266225, -0.64092567,  1.35615349,  0.96889162]])"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "standardScalar.transform(X_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 5.1,  3.5,  1.4,  0.2],\n",
       "       [ 4.9,  3. ,  1.4,  0.2],\n",
       "       [ 5.7,  2.8,  4.1,  1.3],\n",
       "       [ 6.2,  3.4,  5.4,  2.3],\n",
       "       [ 5.1,  2.5,  3. ,  1.1],\n",
       "       [ 7. ,  3.2,  4.7,  1.4],\n",
       "       [ 6.1,  2.6,  5.6,  1.4],\n",
       "       [ 7.6,  3. ,  6.6,  2.1],\n",
       "       [ 5.2,  4.1,  1.5,  0.1],\n",
       "       [ 6.2,  2.2,  4.5,  1.5]])"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_train[:10,:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "X_train = standardScalar.transform(X_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[-0.90616043,  0.94720873, -1.30982967, -1.28485856],\n",
       "       [-1.15301457, -0.18717298, -1.30982967, -1.28485856],\n",
       "       [-0.16559799, -0.64092567,  0.22169257,  0.17345038],\n",
       "       [ 0.45153738,  0.72033239,  0.95909217,  1.49918578],\n",
       "       [-0.90616043, -1.3215547 , -0.40226093, -0.0916967 ],\n",
       "       [ 1.43895396,  0.2665797 ,  0.56203085,  0.30602392],\n",
       "       [ 0.3281103 , -1.09467835,  1.07253826,  0.30602392],\n",
       "       [ 2.1795164 , -0.18717298,  1.63976872,  1.2340387 ],\n",
       "       [-0.78273335,  2.30846679, -1.25310662, -1.4174321 ],\n",
       "       [ 0.45153738, -2.00218372,  0.44858475,  0.43859746]])"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_train[:10,:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "X_test_standard = standardScalar.transform(X_test) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[-0.28902506, -0.18717298,  0.44858475,  0.43859746],\n",
       "       [-0.04217092, -0.64092567,  0.78892303,  1.63175932],\n",
       "       [-1.0295875 , -1.77530738, -0.2320918 , -0.22427024],\n",
       "       [-0.04217092, -0.86780201,  0.78892303,  0.96889162],\n",
       "       [-1.52329579,  0.03970336, -1.25310662, -1.28485856],\n",
       "       [-0.41245214, -1.3215547 ,  0.16496953,  0.17345038],\n",
       "       [-0.16559799, -0.64092567,  0.44858475,  0.17345038],\n",
       "       [ 0.82181859, -0.18717298,  0.84564608,  1.10146516],\n",
       "       [ 0.57496445, -1.77530738,  0.39186171,  0.17345038],\n",
       "       [-0.41245214, -1.09467835,  0.39186171,  0.04087684]])"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_test_standard[:10,:]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "使用归一化后的数据进行knn分类"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from sklearn.neighbors import KNeighborsClassifier"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "knn_clf = KNeighborsClassifier(n_neighbors=3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "KNeighborsClassifier(algorithm='auto', leaf_size=30, metric='minkowski',\n",
       "           metric_params=None, n_jobs=1, n_neighbors=3, p=2,\n",
       "           weights='uniform')"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "knn_clf.fit(X_train, y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "knn_clf.score(X_test_standard, y_test)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "注意，此时不能传入没有归一化的数据！"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.33333333333333331"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "knn_clf.score(X_test, y_test)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 实现我们自己的standardScaler"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "代码参见：[这里](playML/preprocessing.py)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "X_train, X_test, y_train, y_test = train_test_split(iris.data, iris.target, test_size=0.2, random_state=666)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from playML.preprocessing import StandardScaler\n",
    "\n",
    "my_standardScalar = StandardScaler() \n",
    "my_standardScalar.fit(X_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 5.83416667,  3.0825    ,  3.70916667,  1.16916667])"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "my_standardScalar.mean_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0.81019502,  0.44076874,  1.76295187,  0.75429833])"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "my_standardScalar.scale_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "X_train = standardScalar.transform(X_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[-0.90616043,  0.94720873, -1.30982967, -1.28485856],\n",
       "       [-1.15301457, -0.18717298, -1.30982967, -1.28485856],\n",
       "       [-0.16559799, -0.64092567,  0.22169257,  0.17345038],\n",
       "       [ 0.45153738,  0.72033239,  0.95909217,  1.49918578],\n",
       "       [-0.90616043, -1.3215547 , -0.40226093, -0.0916967 ],\n",
       "       [ 1.43895396,  0.2665797 ,  0.56203085,  0.30602392],\n",
       "       [ 0.3281103 , -1.09467835,  1.07253826,  0.30602392],\n",
       "       [ 2.1795164 , -0.18717298,  1.63976872,  1.2340387 ],\n",
       "       [-0.78273335,  2.30846679, -1.25310662, -1.4174321 ],\n",
       "       [ 0.45153738, -2.00218372,  0.44858475,  0.43859746]])"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_train[:10,:]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Scikit-Learn中的最值归一化"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "MinMaxScaler: [http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.MinMaxScaler.html](http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.MinMaxScaler.html)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "练习：同学们也可以尝试实现自己的MinMaxScaler:)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
